package cn.study.luckyapp.record.query;

import cn.study.luckyapp.assembler.RecordAssembler;
import cn.study.luckyclient.dto.data.RecordVo;
import cn.study.luckyclient.dto.query.RecordListByParamQuery;
import cn.study.luckydomain.gateway.RecordGateWay;
import cn.study.luckydomain.record.RecordEntity;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@AllArgsConstructor
public class RecordListByParamQueryExe {
    private final RecordGateWay recordGateWay;
    public IPage<RecordVo> execute(RecordListByParamQuery query) {
        IPage<RecordEntity> page = recordGateWay.page(query);
        return page.convert(RecordAssembler::toRecordVO);
    }
}
